package com.itheima.mapper;

import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrderMapper {

    //根据预约id查询预约信息
    Order findById(String id);

    //通过日期和套餐id查询会员id
    @Select("select member_id from t_order where orderDate=#{orderDate} and setmeal_id=#{setmealId}")
    Integer[] findMemberId(String orderDate, Long setmealId);

    //添加预约信息
    @Insert("insert into t_order(id,orderDate,setmeal_id) " +
            "values(#{id},#{orderDate},#{setmealId})")
    void add(Integer id, String orderDate, Long setmealId);
}
